﻿using System.Web.Mvc;
using System.Web.Routing;

namespace Stimulus360
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvc",Justification ="Stands for Modal View Controller")]
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            #region IgnoreRoutes...
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("captcha.ashx");
            #endregion

            #region Idea Routes

            //Url for submitting new Idea
            routes.MapRoute(
               "NewIdea",
               "Ideas/New",
               new { controller = "Ideas", action = "New" }
           );

            //Url for pagination of list of  New Ideas
            routes.MapRoute(
              "PagedIdeaList",
              "Ideas/Page/{page}",
              new { controller = "Ideas", action = "Index" }
          );

            //Url for list of new Ideas
            routes.MapRoute(
             "IdeaList",
             "Ideas",
             new { controller = "Ideas", action = "Index" }
          );

            //Url for pagination of Ideas searched on given criteria
            routes.MapRoute(
               "PagedSearch",
               "Ideas/Search/{criteria}/{query}/Page/{page}",
               new { controller = "Ideas", action = "Search" }
          );

            //Url for Ideas searched on given criteria.
            routes.MapRoute(
              "Search",
              "Ideas/Search/{criteria}/{query}",
              new { controller = "Ideas", action = "Search" }
          );

            //Url for pagination of ideas for the given category
            routes.MapRoute(
              "PagedCategory",
              "Ideas/Category/{categoryTitle}/Page/{page}",
               new { controller = "Ideas", action = "Category" }
          );

            //Url for ideas for the given category
            routes.MapRoute(
               "Category",
               "Ideas/Category/{categoryTitle}",
               new { controller = "Ideas", action = "Category" }
           );

            //Url to view Idea Details
            routes.MapRoute(
               "IdeasDetails",
               "Ideas/{ideaId}",
                new { controller = "Ideas", action = "Details" }
           );

            //Url to Submit feedback for the given idea
            routes.MapRoute(
               "IdeaSubmitFeedback",
               "Ideas/{ideaId}/Feedback/Submit",
                new { controller = "Ideas", action = "SubmitFeedback" }
           );

            //Url to view list of feedback for the given idea.
            routes.MapRoute(
               "IdeaFeedback",
               "Ideas/{ideaId}/Feedback",
               new { controller = "Ideas", action = "Feedback" }
            );

            //Url for pagination of Feedback list for the given idea
            routes.MapRoute(
               "PagedIdeaFeedback",
               "Ideas/{ideaId}/Feedback/Page/{page}",
               new { controller = "Ideas", action = "Feedback", page = "" }
            );


            #endregion

            #region Project Routes

            //Url for pagination of list of new projects
            routes.MapRoute(
                "PagedProjectList",
                "Projects/Page/{page}",
                new { controller = "Projects", action = "Index" }
            );

            //Url for list of new projects
            routes.MapRoute(
                 "ProjectList",
                 "Projects",
                 new { controller = "Projects", action = "Index" }
            );

            //Url for pagination of list of projects searched on the given criteria
            routes.MapRoute(
              "PagedProjSearch",
              "Projects/Search/{criteria}/{query}/Page/{page}",
              new { controller = "Projects", action = "Search" }
            );

            //Url for list of projects searched on the given criteria
            routes.MapRoute(
              "ProjSearch",
              "Projects/Search/{criteria}/{query}",
              new { controller = "Projects", action = "Search" }
            );

            //Url for pagination of list of projects for the given category
            routes.MapRoute(
              "PagedProjCategory",
              "Projects/Category/{categoryTitle}/Page/{page}",
               new { controller = "Projects", action = "Category" }
            );

            //Url for list of projects for the given category
            routes.MapRoute(
                "ProjCategory",
                "Projects/Category/{categoryTitle}",
                new { controller = "Projects", action = "Category" }
            );

            //Url to view projects photo
            routes.MapRoute(
               "PhotoDetails",
               "Projects/Photo",
                new { controller = "Projects", action = "Photo" }
           );


            //Url to view project details
            routes.MapRoute(
               "ProjectDetails",
               "Projects/{projectId}",
                new { controller = "Projects", action = "Details" }
           );

            //Url to view list of feedback for the given project.
            routes.MapRoute(
               "ProjectFeedback",
               "Projects/{projectId}/Feedback",
               new { controller = "Projects", action = "Feedback" }
            );

            //Url for pagination of Feedback list for the given project
            routes.MapRoute(
               "PagedProjectFeedback",
               "Projects/{projectId}/Feedback/Page/{page}",
               new { controller = "Projects", action = "Feedback", page = "" }
            );

            //Url to Submit a photo for the given project
            routes.MapRoute(
               "SubmitPhoto",
               "Projects/{projectId}/Photos/Submit",
                new { controller = "Projects", action = "SubmitPhoto" }
           );
            //Url to get a paginated list of Project photos
            routes.MapRoute(
               "PagedProjectPhotos",
               "Projects/{projectId}/Photos/Page/{page}",
               new { controller = "Projects", action = "Photos" }
            );

            //Url to get a list of Project photos
            routes.MapRoute(
            "ProjectPhotos",
            "Projects/{projectId}/Photos",
            new { controller = "Projects", action = "Photos" }
         );

            //Url to submit photo
            routes.MapRoute(
              "SubmitDocument",
              "Projects/{projectId}/Documents/Submit",
               new { controller = "Projects", action = "SubmitDocument" }
          );

            //Url to get the paginated list of project documents
            routes.MapRoute(
               "PagedProjectDocs",
               "Projects/{projectId}/Documents/Page/{page}",
               new { controller = "Projects", action = "Documents" }
            );

            //Url to get the project document
            routes.MapRoute(
               "DocDetail",
               "Projects/{projectId}/Documents/{documentId}",
               new { controller = "Projects", action = "Document" }
            );

            //Url to get the list of project documents
            routes.MapRoute(
            "ProjectDocuments",
            "Projects/{projectId}/Documents",
            new { controller = "Projects", action = "Documents" }
         );

            //Url to Submit feedback for the given project
            routes.MapRoute(
               "ProjectSubmitFeedback",
               "Projects/{projectId}/Feedback/Submit",
                new { controller = "Projects", action = "SubmitFeedback" }
           );

            //Url to get the Volunteers for the given project
            routes.MapRoute(
               "ProjectVolunteers",
               "Projects/{projectId}/Volunteers",
                new { controller = "Projects", action = "Volunteers" }
           );
            //Url to get the Volunteers for the given project and page
            routes.MapRoute(
               "PaginatedProjectVolunteers",
               "Projects/{projectId}/Volunteers/Page/{page}",
                new { controller = "Projects", action = "Volunteers" }
           );
            //Url to get the Volunteer for the given project
            routes.MapRoute(
               "ProjectVolunteer",
               "Projects/{projectId}/Volunteer",
                new { controller = "Projects", action = "Volunteer" }
           );

            #endregion

            #region User Profile Routes
            //Url for UserImage for Volunteer and Project Manager
            routes.MapRoute(
               "UserImage",
               "Projects/UserImage/{userName}",
               new { controller = "Projects", action = "UserImage", page = "" }
            );

            //Url for getting the New user Image
            routes.MapRoute(
              "NewUserImage",
              "Account",
               new { controller = "Account", action = "NewUserImage" }
            );

            //Url to edit the user
            routes.MapRoute(
             "Edit",
             "Users/Edit/{userName}",
              new { controller = "Users", action = "Edit" }
           );

            //Url to save the user image
            routes.MapRoute(
             "SaveImage",
             "Users/SaveImage/{userName}",
              new { controller = "Users", action = "SaveImage" }
            );

            #endregion

            #region MyStimulus
            //Url to get the ideas submitted by the user
            routes.MapRoute(
                 "SubmittedIdeas",
                 "Users/{userName}/Ideas",
                  new { controller = "Users", action = "Ideas" }
             );

            //Url to get the list of ideas submitted by the user
            routes.MapRoute(
                  "PagedSubmittedIdeas",
                  "Users/{userName}/Ideas/Page/{page}",
                   new { controller = "Users", action = "Ideas" }
              );

            //Url to get the favorites ideas of the user
            routes.MapRoute(
                   "FavIdeas",
                   "Users/{userName}/FavoriteIdeas",
                    new { controller = "Users", action = "FavoriteIdeas" }
               );

            //Url to get the paginated list of favorite ideas of the user
            routes.MapRoute(
                "PagedFavIdeas",
                "Users/{userName}/FavoriteIdeas/Page/{page}",
                 new { controller = "Users", action = "FavoriteIdeas" }
            );

            //Url to get the recommended ideas of the user
            routes.MapRoute(
               "RecommendedIdeas",
               "Users/{userName}/RecommendedIdeas",
                new { controller = "Users", action = "RecommendedIdeas" }
           );

            //Url to get the paginated list of recommended ideas of the user
            routes.MapRoute(
            "PagedRecommendedIdeas",
            "Users/{userName}/RecommendedIdeas/Page/{page}",
             new { controller = "Users", action = "RecommendedIdeas" }
        );

            //Url to get the volunteered projects
            routes.MapRoute(
                "VolunteeredProjects",
                "Users/{userName}/Projects",
                 new { controller = "Users", action = "Projects" }
            );

            //Url to get the paginated list of volunteered projects
            routes.MapRoute(
            "PagedVolunteeredProjects",
            "Users/{userName}/Projects/Page/{page}",
             new { controller = "Users", action = "Projects" }
            );

            //Url to get the favorite projects of the user
            routes.MapRoute(
                "FavoriteProjects",
                "Users/{userName}/FavoriteProjects",
                 new { controller = "Users", action = "FavoriteProjects" }
            );

            //Url to get the favorite projects of the user
            routes.MapRoute(
            "PagedFavoriteProjects",
            "Users/{userName}/FavoriteProjects/Page/{page}",
             new { controller = "Users", action = "FavoriteProjects" }
            );

            //Url to get the users recommended projects
            routes.MapRoute(
                "RecommendedProjects",
                "Users/{userName}/RecommendedProjects",
                 new { controller = "Users", action = "RecommendedProjects" }
            );

            //Url to get the paginated list of the recommended projects
            routes.MapRoute(
            "PagedRecommendedProjects",
            "Users/{userName}/RecommendedProjects/Page/{page}",
             new { controller = "Users", action = "RecommendedProjects" }
            );

            //Url to get the Users image
            routes.MapRoute(
             "ProfileImage",
             "Users/UserImage/{userName}",
             new { controller = "Users", action = "UserImage" }
            );

            //Url to get the user profile
            routes.MapRoute(
            "UserProfile",
            "Users/{userName}",
             new { controller = "Users", action = "Profile" }
            );

            //Url to get the home view
            routes.MapRoute(
              "Home",
              "Home",
               new { controller = "Home", action = "HomeView" }
            );

            #endregion

            //Default route
            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );

        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",Justification ="Method implementation is part of MVC framework")]
        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }
}